<?php $post = $this->get('post');?>
<form method="post" action="<?php _e(actionUrl($this))?>" onsubmit="return ajax_form(this)"  enctype="multipart/form-data">
<input type="hidden" name="document_id" value="<?php _e($this->get('document_id'))?>"/>
<div class="x-list-title">
		<table width="100%" border="0" height="100%">
		<tr>
			<td align="left">
				<h2>Tạo mới tài liệu
				</h2>
			</td>
			<td align="right">
				<div class="x-list-options">

				</div>
			</td>
		</tr>
		</table>
</div>
<div class="x-form-container">
	<div class="form-message"></div>
	<table width="100%" cellpadding="4" class="x-form">
		<tr>
			<td class="x-form-label" >Loại tài liệu : </td>
			<td class="x-form-input">
				<select name="type" class="x-select">
				<?php $arrDocumetType = $this->get('documentType');
					foreach ($arrDocumetType as $k=>$v){
						?>
						<option value="<?php _e($v['ID']);?>"><?php _e($v['title']);?></option>
						<?php
					}
				?>
				</select>

			</td>
		</tr>

		<tr>
			<td class="x-form-label">Tên tài liệu : </td>
			<td class="x-form-input">
				<input class="x-text" type="text" name="title" style="width:350px"  value="<?php _e($post["title"]);?>"/>
			</td>
		</tr>

		<tr>
			<td class="x-form-label">File đính kèm : </td>
			<td class="x-form-input">
				<?php foreach( $this->get('files') as $file ):?>

				<div class='x-file-info'>
					<input checked type='checkbox' name='files[]' value='<?php _e($file['ID']);?>'/>
					<a href="<?php _ctrUrl($this);?>/File?ID=<?php _e($file['ID']);?>" target="_blank"><?php _e($file['filename']);?> <?php _e($file['size']);?> KB	</a>
				</div>
				<?php endforeach;?>
				<div class="x-files" url="<?php _baseUrl();?>/Document/Index/Upload?ID=<?php _e($post['ID'])?>" post_id="<?php _e($post['ID'])?>"></div>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Người tạo : </td>
			<td class="x-form-input">
				<?php
				_e(get_user_link($this->get('users')))?>
			</td>
		</tr>
		<tr id="userToView">
			<td class="x-form-label">Chia sẻ : </td>
			<td class="x-form-input">
				<div class="x-select-users" x-name="usersView[]" x-title="Xem tài liệu">
				<?php
					$usersGet = $this->get('usersView');

					if(isset($usersGet)){
					foreach($usersGet as $user ){?>
					<span class="item">
						<input type="hidden" name="usersView[]" value="<?php _e($user['ID'])?>"><a><?php _e($user['username'])?></a><span class="close">x</span>
					</span>
				<?php }
					}
				?>
				</div>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Nội dung : </td>
			<td class="x-form-input">
				<textarea name="content" class="x-editor" rows="12" style="width:610px;" cols="50" ><?php _e($post['content']);?></textarea>
			</td>
		</tr>
		<tr>
			<td class="x-form-label"></td>
			<td>
				<input type="submit" value="Xác nhận" class="x-button x-save"/>
				<a href="#Document/Indexp" class="x-button x-fresh">Hủy bỏ</a>
			</td>
		</tr>
	</table>
</div>
</form>